package com.dhcc.bpm.common.utils;

import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

 import java.sql.ResultSet;
 import java.sql.SQLException;

 /**
  * 实现RowMapper接口，返回对象
  * */
 public class TableDataMapper implements RowMapper<TableDataMapper.TableData> {

     @Override
     public TableData mapRow(ResultSet resultSet, int i) throws SQLException {
      //获取结果集中的数据
      String colName = resultSet.getString("column_name");
      String dataType = resultSet.getString("data_type");
      //把数据封装成对象
      TableData tableData = new TableData();
      tableData.setColumn_name(colName);
      tableData.setData_type(dataType);
      return tableData;
     }

  @Data
  public class TableData{
   private String column_name;
   private String data_type;
  }

 }
